function(AddInclude rel_path group_name list_src)
  message(STATUS "AddInclude --> ${rel_path} >> ${group_name}")
  include_directories(${rel_path})
  #遍历所有子目录
  file(GLOB_RECURSE list_globbed "${rel_path}/*.h" "${rel_path}/*.hpp")
  foreach(file ${list_globbed})
    message(STATUS "     - ${file}")
  endforeach()
  set(list_return ${list_globbed} ${${list_src}})
  set(${list_src} ${list_return} PARENT_SCOPE)
  source_group(${group_name} FILES ${list_globbed})
  message(STATUS "-----------------------------------------")
endfunction()

function(AddSources rel_path group_name list_src)
  message(STATUS "AddSources --> ${rel_path} >> ${group_name}")
  #include_directories(${rel_path})
  #遍历所有子目录
  file(GLOB_RECURSE list_globbed "${rel_path}/*.cpp" "${rel_path}/*.cxx")
  foreach(file ${list_globbed})
    message(STATUS "     - ${file}")
  endforeach()
  set(list_return ${list_globbed} ${${list_src}})
  set(${list_src} ${list_return} PARENT_SCOPE)
  source_group(${group_name} FILES ${list_globbed})
  message(STATUS "-----------------------------------------")
endfunction()

function(AddResources rel_path group_name list_res)
  message(STATUS "AddResources --> ${rel_path} >> ${group_name}")
  file(GLOB_RECURSE list_globbed "${rel_path}/*.qml" "${rel_path}/*.png" "${rel_path}/*.ttf" "${rel_path}/*.js" "${rel_path}/*.json" "${rel_path}/*.cfg")
  foreach(file ${list_globbed})
    message(STATUS "     - ${file}")
  endforeach()
  source_group(${group_name} FILES ${list_globbed})
  set(list_return ${list_globbed} ${${list_res}})
  set(${list_res} ${list_return} PARENT_SCOPE)
endfunction()

function(AddResourcesQRC rel_path group_name list_res)
  message(STATUS "AddQRC --> ${rel_path} >> ${group_name}")
  file(GLOB list_globbed "${rel_path}/*.qrc")
  foreach(file ${list_globbed})
    message(STATUS "     - ${file}")
  endforeach()
  source_group(${group_name} FILES ${list_globbed})
  set(list_return ${list_globbed} ${${list_res}})
  set(${list_res} ${list_return} PARENT_SCOPE)
endfunction()

function(AddPlugins rel_path group_name list_src)
  message(STATUS "AddPlugins----> ${rel_path} >> ${group_name}")

  #遍历所有子目录
  file(GLOB_RECURSE list_globbed LIST_DIRECTORIES true "${rel_path}/CMakeLists.txt")
  message(STATUS "--DIR----> ${list_globbed} >> ${group_name}")
  foreach(file ${list_globbed})
     # message(STATUS "0 dir----     - ${file}")

      if(IS_DIRECTORY ${file})
          unset(file_var CACHE) # 清除变量,带有CACHE也从缓存文件CMakeCache.txt中清除,若不带CACHE则缓存文件CMakeCache.txt中仍然存在var的值
          find_path(file_var NAMES CMakeLists.txt HINTS ${file})
          if(IS_DIRECTORY ${file_var})
              message("var----------------------: ${file_var}") 
              add_subdirectory(${file_var}) 
          endif()
          
          #message(STATUS "0 dir----     - ${file}")
          #target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_INCLUDE})
          #add_subdirectory(${file}) 
      endif()
  endforeach()
  set(list_return ${list_globbed} ${${list_src}})
  set(${list_src} ${list_return} PARENT_SCOPE)
  message(STATUS "--DIR----> ${list_src} >> ${list_return}")
  message(STATUS "-----------------------------------------")
  #source_group(${group_name} FILES ${list_globbed})
endfunction()
